<div id="Sticky-tags"></div>
<div class="header">
<p>
Previous: [[cvs: Tagging and adding and removing files#Tagging and adding and removing files|Tagging add/remove]], Up: [[cvs: Revisions#Revisions|Revisions]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>

----

<div id="Sticky-tags-1"></div>
=== Sticky tags ===
<div id="index-Sticky-tags"></div>
<div id="index-Tags_002c-sticky"></div>


Sometimes a working copy&rsquo;s revision has extra data
associated with it, for example it might be on a branch
(see [[cvs: Branching and merging#Branching and merging|Branching and merging]]), or restricted to
versions prior to a certain date by &lsquo;<code>checkout -D</code>&rsquo;
or &lsquo;<code>update -D</code>&rsquo;.  Because this data persists &ndash;
that is, it applies to subsequent commands in the
working copy &ndash; we refer to it as <em>sticky</em>.

Most of the time, stickiness is an obscure aspect of
<small>CVS</small> that you don&rsquo;t need to think about.  However,
even if you don&rsquo;t want to use the feature, you may need
to know ''something'' about sticky tags (for
example, how to avoid them!).

You can use the <code>status</code> command to see if any
sticky tags or dates are set:

<div class="example" style="margin-left: 3.2em">
 $ cvs status driver.c
 ===================================================================
 File: driver.c          Status: Up-to-date
 
     Version:            1.7.2.1 Sat Dec  5 19:35:03 1992
     RCS Version:        1.7.2.1 /u/cvsroot/yoyodyne/tc/driver.c,v
     Sticky Tag:         rel-1-0-patches (branch: 1.7.2)
     Sticky Date:        (none)
     Sticky Options:     (none)
 
</div>

<div id="index-Resetting-sticky-tags"></div>
<div id="index-Sticky-tags_002c-resetting"></div>
<div id="index-Deleting-sticky-tags"></div>
The sticky tags will remain on your working files until
you delete them with &lsquo;<code>cvs update -A</code>&rsquo;.  The
&lsquo;<code>-A</code>&rsquo; option merges local changes into the version of the
file from the head of the trunk, removing any sticky tags,
dates, or options.  See [[cvs: update--Bring work tree in sync with repository#update&mdash;Bring work tree in sync with repository|update]] for more on the operation
of <code>cvs update</code>.

<div id="index-Sticky-date"></div>
The most common use of sticky tags is to identify which
branch one is working on, as described in
[[cvs: Accessing branches#Accessing branches|Accessing branches]].  However, non-branch
sticky tags have uses as well.  For example,
suppose that you want to avoid updating your working
directory, to isolate yourself from possibly
destabilizing changes other people are making.  You
can, of course, just refrain from running <code>cvs
update</code>.  But if you want to avoid updating only a
portion of a larger tree, then sticky tags can help.
If you check out a certain revision (such as 1.4) it
will become sticky.  Subsequent <code>cvs update</code>
commands will
not retrieve the latest revision until you reset the
tag with <code>cvs update -A</code>.  Likewise, use of the
&lsquo;<code>-D</code>&rsquo; option to <code>update</code> or <code>checkout</code>
sets a <em>sticky date</em>, which, similarly, causes that
date to be used for future retrievals.

People often want to retrieve an old version of
a file without setting a sticky tag.  This can
be done with the &lsquo;<code>-p</code>&rsquo; option to <code>checkout</code> or
<code>update</code>, which sends the contents of the file to
standard output.  For example:
<div class="example" style="margin-left: 3.2em">
 $ cvs update -p -r 1.1 file1 &gt;file1
 ===================================================================
 Checking out file1
 RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
 VERS: 1.1
 ***************
 $
</div>

However, this isn&rsquo;t the easiest way, if you are asking
how to undo a previous checkin (in this example, put
&lsquo;<tt>file1</tt>&rsquo; back to the way it was as of revision
1.1).  In that case you are better off using the
&lsquo;<code>-j</code>&rsquo; option to <code>update</code>; for further
discussion see [[cvs: Merging differences between any two revisions#Merging differences between any two revisions|Merging two revisions]].


----

<div class="header">
<p>
Previous: [[cvs: Tagging and adding and removing files#Tagging and adding and removing files|Tagging add/remove]], Up: [[cvs: Revisions#Revisions|Revisions]] &nbsp; |[[cvs: Index#SEC_Contents|Contents]]||[[cvs: Index#Index|Index]]|</p>
</div>
This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
